<template>
  <div>
    <DynamicForm :questions="formQuestions" :config="config"></DynamicForm>
    <DynamicTable :tables="tables" :config="config" :icons="icons"> </DynamicTable>
  </div>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import { DynamicForm } from '@/components/public-template';
import { DynamicTable } from '@/components/public-template';
import { TableBase } from '@/components/public-template';
import { QuestionBase } from '@/components/public-template';
import tableService from './table.service';

let config: any = {
  style: 'table-form',
  
  queryUrl: 'Course/GetAll',
  rowKey: 'id',
  params: {},
  data: [
    {
      name: '课程1',
      type: 1,
      categoryIds: 0,
      price: 100,
      marketPrice: 120,
      buyerCount: 1000,
      tag: 1,
      shelvesTime: 1663139464524,
      id: '1231213'
    },
    {
      name: '课程2',
      type: 2,
      categoryIds: 1,
      price: 100,
      marketPrice: 120,
      buyerCount: 1000,
      tag: 1,
      shelvesTime: 1663139464524,
      id: '111'
    },
    {
      name: '课程3',
      type: 3,
      categoryIds: 3,
      price: 100,
      marketPrice: 120,
      buyerCount: 1000,
      tag: 1,
      shelvesTime: 1663139464524,
      id: '222'
    },
    {
      name: '课程4',
      type: 4,
      categoryIds: 1,
      price: 100,
      marketPrice: 120,
      buyerCount: 1000,
      tag: 1,
      shelvesTime: 1663139464524,
      id: '333'
    }
  ]
};
let icons: TableBase<any>[] = reactive(tableService.getIcons());
let tables: TableBase<any>[] = reactive(tableService.getTables());
let formQuestions: QuestionBase<any>[] = reactive(tableService.getQuestions());
</script>

<style lang="less" scoped></style>
